package com.java.simple.study.jvm.memstruct.methodarea;

/**
 * @author zhoujunlin
 * @date 2021/12/12
 * @desc 演示StringTable垃圾回收
 * 设置堆内存大小  打印StringTable统计信息    打印gc执行信息
 * -Xmx10m -XX:+PrintStringTableStatistics -XX:+PrintGCDetails -verbose:gc
 **/
public class Demo3_4 {

    public static void main(String[] args) {
        int i = 0;
        try{
            for (int j = 0; j < 10000; j++) {
                String.valueOf(j).intern();
            }
        }catch (Throwable t){
            t.printStackTrace();
        }finally {
            System.out.println(i);
        }
    }

}
